package com.changgou.web.gateway.filter;

/**
 * 判断访问地址是否需要传递令牌
 */
public class UrlFilter {

    ///api/worder/**此路径也要拦截,获取令牌进行访问
    public static String filterPath = "/api/worder/**,/api/wseckillorder,/api/seckill,/api/wxpay,/api/wxpay/**,/api/user/**,/api/address/**,/api/wcart/**,/api/cart/**,/api/categoryReport/**,/api/orderConfig/**,/api/order/**,/api/orderItem/**,/api/orderLog/**,/api/preferential/*,/api/returnCause/**,/api/returnOrder/**,/api/returnOrderItem/**";

    public static boolean hasAuthorize(String url){
        String[] split = filterPath.replace("/**", "").split(",");
        for (String value : split) {

            if(url.startsWith(value)){
                return true; //代表当前访问地址是需要传递令牌的
            }
        }

        return false; //代表当前访问地址是不需要传递令牌的
    }

}
